Merging Geometry DataΒΆ

Guerilla is able to merge geometry information from different archive files. Primitive variables (called primvars) such as P (position), N (normal), st (texture coordinates) can be freely overloaded from another file. Here are some example where this is useful:

  • Merging st texture coordinates from a static mesh into the animated mesh, so the animation department is not required to export them, or the lighting department can upgrade them independently from the animation.
  • Merging vertices position and normal from a simulated mesh into the animated mesh, so the lighting departement can work using the animated data, and upgrade to the simulation when it is delivered.
  • Combining both previous strategies.

This example diagram shows how one can organize the data flow so animated positions and normals are coming from the animation stage, while st coordinates is coming from the UVs stage, both UVs and animation being decorelated. Additionally, simulation can be integrated on a selection of objects (typically clothes, skin.)

Requirements

Guerilla indexes data and meshes in geometry archive using the archive file name and an identifier inside that archive. You can find these indices in the Geometry > Geometry Filename and Geometry Path attribute of each Primitive. You have to provide those 2 pieces of information (file path and identifier) to Guerilla for each primvar to merge.

For example, let's consider the left hand mesh of the hero character. The Asset.abc contains T-pose modelling and texture coordinates:

  • Asset.abc
    • /hero
      • /head
      • /body
      • /lefthand
        • /lefthandShape
          • topology
          • P
          • N
          • st
      • ...

It is animated in Anim.abc, along with other animated characters and props, without texture coordinates:

  • Anim.abc
    • /characters
      • /hero
        • /head
        • /body
        • /lefthand
          • /lefthandShape
            • topology
            • P
            • N
        • ...
      • /secondary1
      • /secondary2
      • ...
    • /props
    • ...

Notice that the mesh has a different identifier in both abc files. The mesh eventually breaks down as:

  • topology: file Anim.abc, id /characters/hero/lefthand/lefthandShape
  • P: file Anim.abc, id /characters/hero/lefthand/lefthandShape
  • N: file Anim.abc, id /characters/hero/lefthand/lefthandShape
  • st: file Asset.abc, id /hero/lefthand/lefthandShape
It is mandatory that the source meshes are compatible with each other (typically, same topology, vertices ordering and face ordering.)

To proceed with rendering the animation with updated st coordinates, we'll simply merge the st coordinates from the Asset.abc file.

PrimVarOverride

Use the PrimVarOverride RenderGraph node to setup the primvars to override. Each node can specify several primvars to override within same archive file. Each variable will then have a dedicated identifier in that file.

lefthandShape of hero has a PrimVarOverride

The PrimVarOverride overrides st1 coordinates to Asset.abc, /hero/lefthand/lefthandShape

Override using another source variable

Each overriden variable can use another variable as source. Change the drop down value, or fill it manually. It is also possible to provide a fixed frame, so that the value is fixed in time.

The Pnd variable is overriden to use P at frame 1.

This is useful when you need to shade a deformed object with a procedural noise, for instance. The Pnf coordinates will remain identical for all frames in time. Identical hierarchies

In the case all archives have identical hierarchies, it is possible to replace the PrimVarOVerride identifier with $(GeometryPath) (or simply an empty string.) This is a shortcut for the object's own GeometryPath value.

This also allows to override multiple objects at the same time.

Driving PrimVarOverride with MaterialOverride/Dynamic Attributes

The primvar identifier accepts $(VAR) expressions, where VAR can be:

  • GeometryPath which expands to the object's Geometry Path attribute
  • Any MaterialOverride value
  • Any Dynamic Attributes value
  • Any environment variable.

In case the hierarchies cannot be properly matched, it is still possible to add Dynamic Attributes before export and retrieve this piece of information while merging primvars.

lefthandShape has a Dynamic Attribute assetPath, which is the reference shape identifier in the Asset.abc

The PrimVarOverride node is set so the st1 override expands $(assetPath) with the corresponding Dynamic Attribute, that is /hero/lefthand/lefthandShape in our example.